Skip to content

fix(research-workflow): scaffold() validates the --outline JSON shape (#6862) - #7015

Merged
dezren39 merged 1 commit into
mainfrom
queue/11095-6862-outline-shape
Nov 8, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/11095-6862-outline-shape

Conversation

@developing-today

@developing-today developing-today Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #6862. Queue task 11095.

Problem

scripts/research_workflow.py scaffold() read the init --outline file with a bare json.loads and used its fields raw: a non-object top level and non-object concept entries raised AttributeError, non-string title/slug raised TypeError from the re functions, a non-string summary raised a concatenation TypeError, and a non-JSON outline raised a JSONDecodeError naming no file — none of them the tool's fail() diagnostic naming the file and field.

Change

  • New load_outline(path) helper, used by scaffold() for the --outline file: wraps json.loads (non-JSON → fail() naming the file), then validates shape before any package directory is created:
    • top level must be a JSON object;
    • title / introduction, when present, must be strings;
    • each concept entry must be a JSON object;
    • concept slug / summary, when present, must be strings.
      Every rejection is fail("Outline <file> ... field '<name>' must be a string")-shaped — the file and the field/expectation are always named.
  • Seven regression tests in scripts/tests/test_research_workflow.py (one per wrong shape, incl. the non-JSON body written raw) assert the clean error: diagnostic contains the outline file name and the expectation, and that the tree snapshot is unchanged (no partial package).

Out of scope per the packet: profile/state/trigger shapes (#6854), items manifest shapes (#6856), note/resolution shapes (#6857), dependencies() edge shapes.

Tests

  • python3 -m unittest scripts.tests.test_research_workflow on the laptop: 66 tests OK (59 existing + 7 new). A valid outline flows through the same code paths as before (validation only adds rejections of shapes that previously crashed), and the existing suite covering valid outlines stays green.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…#6862)

load_outline() rejects a non-object top level, a non-JSON body, non-string title/introduction, non-object concept entries, and non-string concept slug/summary via fail() naming the outline file and field, before any package directory is created. Seven regression tests pin each wrong shape and assert no partial writes; a valid outline is unchanged (suite: 66 tests OK on the laptop).
@developing-today
developing-today Bot requested review from a team and dezren39 as code owners November 8, 2026 00:55
@coderabbitai

coderabbitai Bot commented Nov 8, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8901967d-c3a5-4116-97a8-3d68101ad32c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@dezren39
dezren39 merged commit e7113e8 into main Nov 8, 2026
1 of 4 checks passed
@dezren39
dezren39 deleted the queue/11095-6862-outline-shape branch November 8, 2026 02:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

research_workflow(scaffold): the --outline JSON is shape-trusted — wrong shapes and non-JSON fail with raw type errors naming no file or field

1 participant